#region File Description
//-----------------------------------------------------------------------------
// OptionsMenuScreen.cs
//
// Microsoft XNA Community Game Platform
// Copyright (C) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
#endregion

#region Using Statements
using Microsoft.Xna.Framework;
#endregion

namespace CreamX.Framework.GameState.Screens
{
    /// <summary>
    /// The options screen is brought up over the top of the main menu
    /// screen, and gives the user a chance to configure the game
    /// in various hopefully useful ways.
    /// </summary>
    class OptionsMenuScreen : MenuScreen
    {
        #region Fields

        enum Ungulate
        {
            BactrianCamel,
            Dromedary,
            Llama,
        }

        static Ungulate currentUngulate = Ungulate.Dromedary;

        static string[] languages = { "C#", "French", "Deoxyribonucleic acid" };
        static int currentLanguage = 0;

        static bool frobnicate = true;

        static int elf = 23;

        #endregion

        #region Initialization


        /// <summary>
        /// Constructor populates the menu with empty strings: the real values
        /// are filled in by the Update method to reflect the changing settings.
        /// </summary>
        public OptionsMenuScreen():base("Options")
        {
            //MenuEntries.Add(string.Empty);
            //MenuEntries.Add(string.Empty);
            //MenuEntries.Add(string.Empty);
            //MenuEntries.Add(string.Empty);
            //MenuEntries.Add("Back");
        }


        #endregion

        #region Handle Input


        /// <summary>
        /// Updates the options screen, filling in the latest values for the menu text.
        /// </summary>
        public override void Update(GameTime gameTime, bool otherScreenHasFocus,
                                                       bool coveredByOtherScreen)
        {
            base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);

            //MenuEntries[0] = "Preferred ungulate: " + currentUngulate.ToString();
            //MenuEntries[1] = "Language: " + languages[currentLanguage];
            //MenuEntries[2] = "Frobnicate: " + (frobnicate ? "on" : "off");
            //MenuEntries[3] = "elf: " + elf.ToString();
        }


        /// <summary>
        /// Responds to user menu selections.
        /// </summary>
        protected override void OnSelectEntry(int entryIndex)
        {
            switch (entryIndex)
            {
                case 0:
                    // Change the "preferred ungulate" setting.
                    currentUngulate++;

                    if (currentUngulate > Ungulate.Llama)
                        currentUngulate = 0;

                    break;

                case 1:
                    // Change the "language" setting.
                    currentLanguage = (currentLanguage + 1) % languages.Length;
                    break;

                case 2:
                    // Change the "frobnicate" setting.
                    frobnicate = !frobnicate;
                    break;

                case 3:
                    // Change the "elf" setting.
                    elf++;
                    break;

                case 4:
                    // Go back to the main menu.
                    ExitScreen();
                    break;
            }
        }


        /// <summary>
        /// When the user cancels the options screen, go back to the main menu.
        /// </summary>
        protected override void OnCancel()
        {
            ExitScreen();
        }


        #endregion
    }
}
